/* 
 * Enterprise Library Extensions - DI + ORM.
 * Copyright (C) 2006
 *
 * GNU General Public License
 *
 * This program is free software; you can redistribute 
 * it and/or modify it under the terms of the GNU General Public License 
 * as published by the Free Software Foundation; either version 2 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 */
using System;
using System.Collections.Specialized;
using System.Xml.Serialization;

namespace ELE.EnterpriseLibrary.Aspects.Sinks
{
	/// <summary>
	/// Summary description for AspectConfiguration.
	///
	/// Author: Miguel Curi
	///
	/// </summary>
	public class AspectConfiguration
	{
    private string componentName;
    private string methodName;
    private StringCollection orderedArgs;
    private JoinPoint joinPoint = JoinPoint.Pre;
    /// <summary>
    /// Main aspect configuration object
    /// </summary>
		public AspectConfiguration()
		{
		}
    /// <summary>
    /// Component name to use for aspect advices
    /// </summary>
    [XmlAttribute("component")]
    public string ComponentName { get { return componentName; } set { componentName = value; } }
    /// <summary>
    /// The method name
    /// </summary>
    [XmlAttribute("method")]
    public string MethodName { get { return methodName; } set { methodName = value; } }
    /// <summary>
    /// Arguments of the method
    /// </summary>
    [XmlArrayItem("name")]
    [XmlArray("arguments")]
    public StringCollection OrderedArgs { get { return orderedArgs; } set { orderedArgs = value; } }
    /// <summary>
    /// Join-point is either pre or post for running the method before entering the method that is being 
    /// intercepted or after it
    /// </summary>
    [XmlAttribute("join-point")]
    public JoinPoint JoinPoint { get { return joinPoint; } set { joinPoint = value; } }
	}
  /// <summary>
  /// Defines when to call the aspect, before or after the method is called
  /// </summary>
  public enum JoinPoint
  {
    /// <summary>
    /// Before
    /// </summary>
    Pre,
    /// <summary>
    /// After
    /// </summary>
    Post
  }
}
